package py;

import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * @author pengyu
 */
@Getter
@Setter
public class DefaultTask implements Task {
    private String id;
    private String desc;
    private Runnable task;

    public DefaultTask() {
    }

    public DefaultTask(String id, String desc, Runnable task) {
        this.id = id;
        this.desc = desc;
        this.task = task;
    }

    @Override
    public void handle() {
        Objects.requireNonNull(task);
        task.run();
    }

}
